﻿module fitbit.Helpers {

    export class GraphHelper {
        static weekDays: Array<string> = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri","Sat" ];

        static $inject = [];
        constructor() {
        }

        static GetActivitySleepGraphOptions(): any {
            var weekDays = this.weekDays;
            return {
                stacks: [{ axis: "y", series: ["id_0", "id_1", "id_2"] }],
                lineMode: "cardinal",
                series: [
                    {
                        id: "id_0",
                        y: "val_0",
                        label: "Soft",
                        type: "column",
                        color: "#1f77b4",
                        axis: "y"
                    },
                    {
                        id: "id_1",
                        y: "val_1",
                        label: "Moderate",
                        type: "column",
                        color: "#ff7f0e",
                        axis: "y"
                    },
                    {
                        id: "id_2",
                        y: "val_2",
                        label: "Intense",
                        type: "column",
                        color: "#d62728",
                        axis: "y"
                    }
                ],
                axes: {
                    x: {
                        type: "date",
                        key: "x",
                        labelFunction: function (value) {
                            //takes the date object? and returns a string
                            return weekDays[value.getDay()] + ' ' + (value.getDate());
                            //return (value.getMonth() + 1) + '/' + value.getDate();
                        }
                    },
                    y: {
                        type: "linear"
                    }
                },

                tension: 0.7,
                tooltip: {
                    mode: "scrubber",
                    formatter: function (x, y, series) {
                        return series.label + ' : ' + y;
                    }
                },
                drawLegend: true,
                drawDots: true,
                columnsHGap: 5
            };
        }
    }
}